//
//  TYHDefineConst.h
//  OpenPractice
//
//  Created by tanyuehong on 16/8/24.
//  Copyright © 2016年  lijinghua. All rights reserved.
//  这里专门定义全局的宏定义


//======全局常量定义=============

// weak和strong的定义

#ifndef weakify
#if DEBUG
#if __has_feature(objc_arc)
#define op_weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object;
#else
#define op_weakify(object) autoreleasepool{} __block __typeof__(object) block##_##object = object;
#endif
#else
#if __has_feature(objc_arc)
#define op_weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object;
#else
#define op_weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object;
#endif
#endif
#endif

#ifndef strongify
#if DEBUG
#if __has_feature(objc_arc)
#define op_strongify(object) autoreleasepool{} __typeof__(object) object = weak##_##object;
#else
#define op_strongify(object) autoreleasepool{} __typeof__(object) object = block##_##object;
#endif
#else
#if __has_feature(objc_arc)
#define op_strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object;
#else
#define op_strongify(object) try{} @finally{} __typeof__(object) object = block##_##object;
#endif
#endif
#endif

// 设备适配相关
#define SCREENWIDTH   ([UIScreen mainScreen].bounds.size.width)
#define SCREENHEIGHT  ([UIScreen mainScreen].bounds.size.height)
//适配系数
#define ADAPTERSIZESCALE  (SCREENWIDTH/750.0)

//这里定义了全局的文字大小的三种字
#define FONTSIZE        12
#define FONTSIZESMALL   10
#define FONTSIZEBIG     14


//颜色和透明度设置
#define RGBA(r,g,b,a)            [UIColor colorWithRed:(float)r/255.0f green:(float)g/255.0f blue:(float)b/255.0f alpha:a]
#define RGB(r,g,b)               [UIColor colorWithRed:(float)r/255.0f green:(float)g/255.0f blue:(float)b/255.0f alpha:1.0]


// 设备相关的判断

//判断iPhoneX
#define DeviceIsIphoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !DeviceIsPad : NO)
//判断iPHoneXr
#define DeviceIsIphoneXR ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) && !DeviceIsPad : NO)
//判断iPhoneXs
#define DeviceIsIphoneXS ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !DeviceIsPad : NO)
//判断iPhoneXs Max
#define DeviceIsIphoneXS_MAX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) && !DeviceIsPad : NO)
//判断是否为全面屏
#define DeviceIsFullScreen (DeviceIsIphoneX == YES || DeviceIsIphoneXR == YES || DeviceIsIphoneXS == YES || DeviceIsIphoneXS_MAX == YES)
